{% extends 'account/base.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% block title %}{% trans "User Profile" %}{% endblock %}

{% block content %}
  <div class="row mb-3">
    <div class="col-md-6">
      <div class="card">
        <h5 class="card-header">{% trans "Account Details" %}</h5>
        <div class="card-body">
          <table class="table table-hover attr-table">
            <tr>
              <th scope="row">{% trans "Username" %}</th>
              <td>{{ request.user.username }}</td>
            </tr>
            <tr>
              <th scope="row">{% trans "Full Name" %}</th>
              <td>
                {% if request.user.first_name or request.user.last_name %}
                  {{ request.user.first_name }} {{ request.user.last_name }}
                {% else %}
                  {{ ''|placeholder }}
                {% endif %}
              </td>
            </tr>
            <tr>
              <th scope="row">{% trans "Email" %}</th>
              <td>{{ request.user.email|placeholder }}</td>
            </tr>
            <tr>
              <th scope="row">{% trans "Account Created" %}</th>
              <td>{{ request.user.date_joined|annotated_date }}</td>
            </tr>
            <tr>
              <th scope="row">{% trans "Superuser" %}</th>
              <td>{% checkmark request.user.is_superuser %}</td>
            </tr>
            <tr>
              <th scope="row">{% trans "Admin Access" %}</th>
              <td>{% checkmark request.user.is_staff %}</td>
            </tr>
          </table>
        </div>
      </div>
    </div>
    <div class="col-md-6">
      <div class="card">
        <h5 class="card-header">{% trans "Assigned Groups" %}</h5>
        <ul class="list-group list-group-flush">
          {% for group in request.user.groups.all %}
            <li class="list-group-item">{{ group }}</li>
          {% empty %}
            <li class="list-group-item text-muted">{% trans "None" %}</li>
          {% endfor %}
        </ul>
      </div>
    </div>
  </div>
  {% if perms.extras.view_objectchange %}
    <div class="row">
      <div class="col-md-12">
        <div class="card">
          <h5 class="card-header text-center">{% trans "Recent Activity" %}</h5>
          <div class="card-body table-responsive">
            {% render_table changelog_table 'inc/table.html' %}
          </div>
        </div>
      </div>
    </div>
  {% endif %}
{% endblock %}
